package com.atguigu.testdemo.cart_info.controller;

import com.atguigu.testdemo.cart_info.bean.CartInfo;
import com.atguigu.testdemo.cart_info.service.CartInfoService;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 购物车表 用户登录系统时更新冗余 前端控制器
 * </p>
 *
 * @author wumingshi
 * @since 2024-08-28
 */
@RestController
@RequestMapping("/cart_info/cartInfo")
public class CartInfoController {

    @Autowired
    CartInfoService cartInfoService;

    @GetMapping("/get/{id}")
    public CartInfo getCartInfo(@PathVariable("id") Long id){
        CartInfo cartInfo = cartInfoService.getById(id);
        return cartInfo;
    }

    @PostMapping("/update")
    public Boolean updateCartInfo(@RequestBody CartInfo cartInfo){
        boolean update = cartInfoService.updateById(cartInfo);
        return update;
    }
}
